package main

import (
	"fmt"
	"net/http"
	"time"
)

type myServer struct{}

func (this *myServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "通过自己创建server的详细配置来调用listenandserve方法")
}

func main() {
	ms := myServer{}
	server := http.Server{
		Addr:        ":8080",
		Handler:     &ms,
		ReadTimeout: 2 * time.Second,
	}
	server.ListenAndServe()
}
